package com.hkts.naturalgas.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
 * @ClassNameCustomPageUtils
 * @Description
 * @Author yck
 * @Date2020-07-28 15:31
 * @Version V1.0
 **/
public class CustomPageUtils {
    public static   CustomPage getCustomPage(IPage page){
        CustomPage  customPage=new  CustomPage();
        customPage.setPageNumber(page.getCurrent());
        customPage.setPageSize(page.getSize());
        customPage.setTotalPages(page.getPages());
        customPage.setTotalRows(page.getTotal());
        customPage.setResultData(page.getRecords());
        return customPage;
    }
    public static   Page getPage(CustomPage customPage){
        return new Page(customPage.getPageNumber(),customPage.getPageSize());
    }
}
